//
// CAsyncTextureManager.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CAsyncTextureManager {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CAsyncTextureManager(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CAsyncTextureManager obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CAsyncTextureManager(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setHLSManager(CHLSTextureManager value) {
    nel3dJNI.CAsyncTextureManager_HLSManager_set(swigCPtr, this, CHLSTextureManager.getCPtr(value), value);
  }

  public CHLSTextureManager getHLSManager() {
    return new CHLSTextureManager(nel3dJNI.CAsyncTextureManager_HLSManager_get(swigCPtr, this), true);
  }

  public CAsyncTextureManager() {
    this(nel3dJNI.new_CAsyncTextureManager(), true);
  }

  public void setupLod(long baseLevel, long maxLevel) {
    nel3dJNI.CAsyncTextureManager_setupLod(swigCPtr, this, baseLevel, maxLevel);
  }

  public void setupMaxUploadPerFrame(long maxup) {
    nel3dJNI.CAsyncTextureManager_setupMaxUploadPerFrame(swigCPtr, this, maxup);
  }

  public void setupMaxHLSColoringPerFrame(long maxCol) {
    nel3dJNI.CAsyncTextureManager_setupMaxHLSColoringPerFrame(swigCPtr, this, maxCol);
  }

  public void setupMaxTotalTextureSize(long maxText) {
    nel3dJNI.CAsyncTextureManager_setupMaxTotalTextureSize(swigCPtr, this, maxText);
  }

  public long addTextureRef(String textName, CMeshBaseInstance instance, CVector position) {
    return nel3dJNI.CAsyncTextureManager_addTextureRef(swigCPtr, this, textName, CMeshBaseInstance.getCPtr(instance), instance, CVector.getCPtr(position), position);
  }

  public void releaseTexture(long id, CMeshBaseInstance instance) {
    nel3dJNI.CAsyncTextureManager_releaseTexture(swigCPtr, this, id, CMeshBaseInstance.getCPtr(instance), instance);
  }

  public boolean isTextureUpLoaded(long id) {
    return nel3dJNI.CAsyncTextureManager_isTextureUpLoaded(swigCPtr, this, id);
  }

  public SWIGTYPE_p_NLMISC__CBitmap getCoarseBitmap(long id) {
    long cPtr = nel3dJNI.CAsyncTextureManager_getCoarseBitmap(swigCPtr, this, id);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CBitmap(cPtr, false);
  }

  public void update(IDriver pDriver) {
    nel3dJNI.CAsyncTextureManager_update(swigCPtr, this, IDriver.getCPtr(pDriver), pDriver);
  }

  public long getTotalTextureSizeAsked() {
    return nel3dJNI.CAsyncTextureManager_getTotalTextureSizeAsked(swigCPtr, this);
  }

  public long getLastTextureSizeGot() {
    return nel3dJNI.CAsyncTextureManager_getLastTextureSizeGot(swigCPtr, this);
  }

}
